//package com.plian.system.controller.dg;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.plian.Tools.Func;
//import com.plian.Tools.StringPool;
//import com.plian.Tools.base.BaseController;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.entity.dg.EnterpriseSystem;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.mybatis.search.SearchEntity;
//import com.plian.system.mybatis.search.SearchParamEntiy;
//import com.plian.system.mybatis.search.TokenSearch;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.dg.IEnterpriseSystemService;
//import com.plian.system.vo.dg.EnterpriseSystemVO;
//import com.plian.system.wrapper.dg.EnterpriseSystemWrapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.validation.Valid;
//import java.util.List;
//
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/enterpriseSystem")
//@Api(value = "EnterpriseSystemController", tags = "企业制度文件 控制器")
//public class EnterpriseSystemController  extends BaseController {
//
//    private IEnterpriseSystemService epstService;
//    private EnterpriseSystemWrapper epstWrapper;
//
//    @PostMapping("/detail")
//    @ApiOperation(value = "详情", notes = "传入enterpriseSystem")
//    public R<EnterpriseSystemVO> detail(@RequestBody EnterpriseSystem enterpriseSystem){
//       EnterpriseSystem detail = epstService.getOne(Condition.getQueryWrapper(enterpriseSystem));
//       EnterpriseSystemVO epstVO = epstWrapper.entityToVO(detail);
//        return R.data(epstVO);
//    }
//
//    @PostMapping("/submit")
//    @ApiOperation(value = "新增或调整", notes = "传入enterpriseSystem")
//    public R<EnterpriseSystem> submit(@Valid @RequestBody EnterpriseSystem enterpriseSystem){
//        boolean result = epstService.submit(enterpriseSystem);
//        return result ? R.data(enterpriseSystem) : new R(CommonCode.FAIL);
//    }
//
//    @PostMapping("/list")
//    @ApiOperation(value = "分页", notes = "传入query")
//    public ListResult<EnterpriseSystemVO> list(@RequestBody Query query){
//        List<SearchEntity> entityList = query.getSearch();
//        if(query.getAscs() == null && query.getDescs() == null){
//            query.setDescs("create_time");
//        }
//        QueryWrapper<EnterpriseSystem> queryWrapper = SearchParamEntiy.getQueryWrapper(
//                Condition.getQueryWrapper(new EnterpriseSystem()), entityList
//        );
//        TokenSearch<EnterpriseSystem> tokenSearch = new TokenSearch<>();
//		tokenSearch.addTokenNoFlowQuery(queryWrapper, query);
//
//        IPage<EnterpriseSystem> pages = epstService.page(Condition.getPage(query), queryWrapper);
//        List<EnterpriseSystemVO> systemVOS = epstWrapper.entityToVO(pages.getRecords());
//
//        ListResult<EnterpriseSystemVO> listResult = new ListResult<>(CommonCode.SUCCESS);
//        listResult.setList(systemVOS);
//        listResult.setTotal(Long.valueOf(pages.getTotal()).intValue());
//        return listResult;
//    }
//
//    @PostMapping("/failure")
//    @ApiOperation(value = "失效", notes = "传入enterpriseSystem")
//    public R failure(@RequestBody EnterpriseSystem enterpriseSystem){
//        return epstService.failure(enterpriseSystem);
//    }
//
//    @PostMapping("/submit")
//    @ApiOperation(value = "删除", notes = "传入 ids")
//    public R remove(@RequestBody PageData pd) {
//        List<String> ids = (List<String>)pd.get("ids");
//        return epstService.deleteLogic(Func.toLongList(StringUtils.join(ids, StringPool.COMMA)))
//                ? new R(CommonCode.SUCCESS) : new R(CommonCode.FAIL);
//    }
//
//}
